﻿
@{
    ViewBag.Title = "Comment";
    Layout = "~/Views/Shared/Admin/_LayoutAdmin.cshtml";
}

@using AIKE_Model;

<link href="~/Common/layUI/theme/layui.css" rel="stylesheet" />
<div class="panel panel-default">
    <div class="panel-heading">评论管理</div>
    <table class="table">
        <thead>
            <tr>
                <th>#</th>
                <th>编号</th>
                <th>评论者</th>
                <th>内容</th>
                <th>所属项目</th>
                <th>评论时间</th>
            </tr>
        </thead>
        <tbody>
            @*<tr>
                <td> <input type="checkbox" /> </td>
                <td>Rammohan </td>
                <td>Reddy</td>
                <td>A+</td>
                <td>A+</td>
            </tr>*@
            @foreach(CommentList m in (List<CommentList>)ViewData["comment"])
            {
            <tr> <td> <input type="checkbox" /> </td><td>@m.CommentID</td> <td>@m.AccountNumber</td> <td>@m.CommentContent</td> <td>@m.ProjectName</td>  <td>@m.CommentTime</td></tr>
            }
        </tbody>
    </table>
</div>
<div class="alert alert-success" role="alert">
    操作： <a class="allcheck">全选</a>&nbsp;&nbsp;|&nbsp;<a href="#" class="delete">删除</a>&nbsp;&nbsp;<a href="#" class="">隐藏</a>&nbsp;&nbsp;<a href="#" class="">审核</a>
</div>
<script src="~/Common/jquery-2.1.1.js"></script>
<script src="~/Common/layUI/layer.js"></script>
<script src="~/Lib/Admin/js/Comment.js"></script>
<script>
    $(function () {

        $(".delete").click(function () {
            
            if ($("input[type='checkbox']").is(':checked')) {
                var mycars = new Array();
                $("input:checked").each(function (i) {
                     
                    var obj = $(this).parents("tr").children("td:eq(1)").text();
                    
                    mycars[i] = obj;
                    alert(mycars[i])
                
                });
                $.ajax({
                    url: "../Admin/DeleteComment",
                    traditional: true,
                    dataType: "json",
                    data: { "id": mycars },
                    success: function (data) {
                        
                        if (parseInt(data) == 1) {
                            layer.msg("删除成功！", { icon: 1 });
                            setTimeout("location.href='../Admin/Comment'",2000);
                        }
                        else{
                            layer.msg("删除失败！", { icon: 2 });
                        }
                    },
                    error: function () {
                       
                        layer.msg("删除失败！", { icon: 2 });
                    }

                });
               
            }

        });


    });
</script>



